<?php
//验证码检测
function check_verify($code, $id = ''){
	$verify = new \Think\Verify();
	return $verify->check($code, $id);
}
//提取缩略图路径
function pic_url($matches,$bid,$width=175,$height=117){
	$imgUrl = str_replace("&quot;".__ROOT__, ".", $matches[3][0]);
	if (!is_dir('./Uploads/thumb/')) mkdir('./Uploads/thumb/');
	//if (!is_dir('./Uploads/thumb/'.date('Ymd',time()))) mkdir('./Uploads/thumb/'.date('Ymd',time()));
	$thumbUrl = "./Uploads/thumb/".$bid.".jpg";
	//实例化图像类
	$image = new \Think\Image();
	$image->open($imgUrl);
	$image->thumb($width,$height,\Think\Image::IMAGE_THUMB_CENTER)->save($thumbUrl);
	$thumbUrl1 = str_replace("./", "/", $thumbUrl);
	return $thumbUrl1;
}
/**
 * 获取所有子分类ID
 * @param $array
 * @param $id
 */
function get_all_child($array,$id){
    $arr = array();
    foreach($array as $v){
        if($v['pid'] == $id){
            $arr[] = $v['id'];
            $arr = array_merge($arr,get_all_child($array,$v['id']));
        }
    }
    return $arr;
}